package com.yh.supergo.manager.controller;

import com.yh.supergo.manager.service.ItemCatService;
import com.yh.supergo.pojo.Itemcat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 0715-YuHao
 * @version 1.0
 * @className ItemCatController
 * @description TODO
 * @date 2020/11/16 22:33
 */
@RestController
@RequestMapping("/cat")
public class ItemCatController {

    @Autowired
    private ItemCatService itemCatService;

    @GetMapping("/category")
    public List<Itemcat> getItemCatList() {
        return itemCatService.getItemCatList();
    }

    @GetMapping("/category/{categoryId}")
    public Itemcat getItemCatById(@PathVariable long categoryId) {
        return itemCatService.findOne(categoryId);
    }

}
